﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace HZ.Supervise.Web.Admin
{
    public partial class NoteInfo : BasePage
    {
        /// <summary>
        /// 消息的类别
        /// </summary>
        public string MSGType { get; set; }

        public NoteInfo()
        {
            //this.ModuleNo = "";
        } 
        HZ.Supervise.IBLL.IExecuteContext im = HZ.Supervise.BLLFactory.ExecuteContext();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                BindInfo();
            }
        }

        /// <summary>
        /// 绑定公告的详细信息
        /// </summary>
        private void BindInfo()
        {
            if (!string.IsNullOrEmpty(Request.QueryString["flag"]) && !string.IsNullOrEmpty(Request.QueryString["mID"]))
            {
                int temp;
                //获取公告类别（N1：已接收的公告；N2：待审核的公告；N3:已发布的公告）
                string flag = Request.QueryString["flag"];
                string id = Request.QueryString["mID"];
                hdfID.Value = id; 
                if (flag == "N1")
                {
                    MSGType = "已接收";
                    Model.View.Notice aNotice = im.GetRecievedNotice(new Model.Query.QNotice() { NoticeSerialID = id }, 1, 0, out temp)[0];
                    lblTitle.Text = aNotice.Title;
                    txtContent.Visible = false;
                    txtTitle.Visible = false;
                    tdReciever.InnerText = aNotice.RoleNames;
                    tdSender.InnerText = aNotice.SenderName;
                    tdSendTime.InnerText = aNotice.SendTime.ToString();
                    ltrContent.Text = aNotice.NoticeContent;
                    hdfReciever.Value = aNotice.Reciever;
                    hdfSender.Value = aNotice.Sender;
                } 
            }
            else
            {
                PageError("数据已经不存在，请先选择相应的公告！", this.ReturnUrl);
            }
        } 
    }
}